<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>OAuth in Action: OAuth Client</title>

    <!-- Bootstrap -->
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
	<style>
	body {
	  padding-top: 60px;
	}
	.navbar-inverse {
		background-color: #223;
	}
	</style>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>

    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <a class="navbar-brand" href="/">OAuth in Action: <span class="label label-primary">OAuth Client</span></a>
        </div>
      </div>
    </nav>

    <div class="container">

      <div class="jumbotron">
		  <p>Access token value: <span class="label label-danger"><%- access_token ? access_token : 'NONE' %></span></p>
		  <p>Scope value: <span class="label label-danger"><%- scope ? scope : 'NONE' %></span></p>
		  <p>Refresh token value: <span class="label label-danger"><%- refresh_token ? refresh_token : 'NONE' %></span></p>
		  <p>Client ID: <span class="label label-danger"><%- client.client_id ? client.client_id : 'NONE' %></span></p>
		  <p>Client Secret: <span class="label label-danger"><%- client.client_secret ? client.client_secret : 'NONE' %></span></p>
		  <p>Registration access token: <span class="label label-danger"><%- client.registration_access_token ? client.registration_access_token : 'NONE' %></span></p>
		  <p>Client configuration management endpoint: <span class="label label-danger"><%- client.registration_client_uri ? client.registration_client_uri : 'NONE' %></span></p>
		  <a class="btn btn-default" href="/authorize">Get OAuth Token</a> 
		  <a class="btn btn-default" href="/fetch_resource">Get Protected Resource</a>
		  <% if (client.registration_access_token) { %>
		  <hr />
		  <a class="btn btn-default" href="/read_client">Read Client Information</a>
		  <form method="POST" action="/update_client">
		  <label for="client_name">New Client Name</label>
		  <input type="text" name="client_name" value="<%- client.client_name ? client.client_name : '' %>" />
		  <button type="submit" class="btn btn-default" >Update Client Registration</button> 
	  	  </form>
		  <a class="btn btn-default" href="/unregister_client">Unregister Client</a> 
		  <% } %>
      </div>

    </div><!-- /.container -->

	
	
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  </body>
</html>
